import React from 'react';
import {Button} from 'antd';

export default class {
    processTableColumns = () => {
        let columns = this.models.modelSet.get('columns');

        columns = this.addOptCol(columns);

        return columns;
    }

    addOptCol = (columns) => {
        const data = this.models.modelSet.get('data');
        const status = this.models.modelSet.get('editStatus');

        columns[2].render = (e, rowData, index) => {
            if (status) {
                
            }
            else {
                return (
                    <>
                        <Button
                            size="small"
                            type="primary"
                        >
                            修改
                        </Button>
                        <Button
                            size="small"
                        >
                            删除
                        </Button>
                        {
                            data.length - 1 === index && 
                            <Button
                                size="small"
                            >
                                新增
                            </Button>
                        }
                    </>
                );
            }
        }

        return columns;
    }
}